﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Areas/SystemAdmin/Master.Master" CodeBehind="MarketingStaff.aspx.cs" Inherits="OnlineBusinesses.Areas.SystemAdmin.MarketingStaff" %>
<asp:Content ContentPlaceHolderID="ContentSystemAdmin" runat="server" ID="ContentAdmin">
    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:10px;">
        <script type="text/javascript">
            $(document).ready(function () {
                // prepare the data
                var data = new Array();
                var danhsachs =
                [
                    "Lệnh Hồ Xung", "Nhậm Doanh Doanh", "Trương Vô Kỵ"
                ];
                var dichvus =
                [
                    "Gói dùng thử", "Gói Khởi nghiệp", "Gói chuyên nghiệp"
                ];
                var hoatdongs =
                [
                    "<span class='fa fa-circle' style='color:#0d0;'></span>", "<span class='fa fa-circle' style='color:#d00;'></span>", "<span class='fa fa-circle' style='color:#dd0;'></span>"
                ];
                for (var i = 0; i < 50; i++) {
                    var row = {};
                    var quantity = 1 + Math.round(Math.random() * 100);
                    var tien;
                    var myArray = ['500', '1000'];
                    var rand = myArray[Math.floor(Math.random() * myArray.length)];
                    var myArray2 = ['5000', '50000','100000'];
                    var rand2 = myArray2[Math.floor(Math.random() * myArray2.length)];
                    row["danhsach"] = danhsachs[Math.floor(Math.random() * danhsachs.length)];

                    row["dichvu"] = dichvus[Math.floor(Math.random() * dichvus.length)];
                    if (row["dichvu"] == "Gói dùng thử")
                    {
                        tien=2;
                    }
                    else
                    {
                        if (row["dichvu"] == "Gói khởi nghiệp")
                            tien=30;
                        else
                            tien=50;
                    }
                    row["hanngach"] = rand2;
                    if (row["hanngach"] == "5000") {
                        tien2 = 40;
                    }
                    else {
                        if (row["hanngach"] == "50000")
                            tien2 = 70;
                        else
                            tien2 = 120;
                    }
                    row["souser"] = quantity;
                    row["sotainguyen"] = rand + " Mbs";
                    row["hoatdong"] = hoatdongs[Math.floor(Math.random() * hoatdongs.length)];
                    row["phiuser"] = quantity * 5;
                    row["phihanngach"] = tien2;
                    row["phitainguyen"] = rand * 0.04;
                    row["phidichvu"] = tien;
                    row["tongphi"] = row["phiuser"] + row["phitainguyen"] + row["phidichvu"] + row["phihanngach"];
                    data[i] = row;
                }
                var source =
                {
                    localdata: data,
                    datatype: "array",
                    datafields:
                    [
                        { name: 'danhsach', type: 'string' },
                        { name: 'hanngach', type: 'number' },
                        { name: 'souser', type: 'string' },
                        { name: 'sotainguyen', type: 'number' },
                        { name: 'dichvu', type: 'string' },
                        { name: 'hoatdong', type: 'string' },
                        { name: 'phiuser', type: 'number' },
                        { name: 'phihanngach', type: 'number' },
                        { name: 'phitainguyen', type: 'number' },
                        { name: 'phidichvu', type: 'number' },
                        { name: 'tongphi', type: 'number' }
                    ]
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
                
                $("#jqxgrid").jqxGrid(
                {
                    width: $("#jqxgrid").width(),
                    source: dataAdapter,
                    pageable: true,
                    autoheight: true,
                    sortable: true,
                    selectionmode: 'multiplecellsadvanced',
                    
                    columnsresize: true,
                    columns: [
                      { text: '', dataField: 'hoatdong', width: 30,cellsalign: 'center' },
                      { text: 'Tên khách hàng', dataField: 'danhsach' },
                      { text: 'Email thêm', dataField: 'hanngach', width: 100 },
                      { text: 'Phí email', dataField: 'phihanngach', width: 85, cellsalign: 'center'},
                      { text: 'Dịch vụ', dataField: 'dichvu', width: 140 },
                      { text: 'Phí Dịch vụ', dataField: 'phidichvu', width: 85, cellsalign: 'center' },
                      { text: 'User thêm', dataField: 'souser', width: 80 },
                      { text: 'Phí User', dataField: 'phiuser', width: 80, cellsalign: 'center' },
                      { text: 'Tài nguyên thêm', dataField: 'sotainguyen', width: 120},
                      { text: 'Phí Tài nguyên', dataField: 'phitainguyen', width: 120, cellsalign: 'center'},
                      { text: 'Tổng chi phí', dataField: 'tongphi', width: 100, cellsalign: 'center' },
                      {
                          text: 'Lịch sử giao dịch', width: 120, cellsalign: 'center', cellsrenderer: function () {
                              return "<a href='MarketingStaffDetail.aspx?uid="+ 1 +"' style='color:#333;text-decoration:none;margin-left:40%;' >Xem</a>";
                          }
                      }
                    ]
                });
            });
        </script>
        <h3 style="font-weight:bold;">Quản lý kinh doanh
            <button type="button" class="btn btn-default pull-right hidden-xs hidden-sm" style="margin-right:20px;border-radius:0px;border:1px solid #ddd;padding-top:10px;" value="Back" onclick="history.go(-1);">
                <span class="fa fa-mail-reply" style="font-size:20px;"></span>
            </button>
        </h3>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:10px;">
            <div class="col-md-4 col-xs-12 col-sm-12 col-lg-4" style="padding:0px;">
                <div class="col-md-4 col-xs-12 col-sm-12 col-lg-4" style="padding:5px;line-height:34px;">Tìm kiếm khách</div>
                <div class="col-md-8 col-xs-12 col-sm-12 col-lg-8" style="padding:5px;"><input class="input_add" placeholder="Theo tên.." /></div>
            </div>
            <div class="col-md-3 col-xs-12 col-sm-12 col-lg-3" style="padding:0px;">
                <div class="col-md-4 col-xs-12 col-sm-12 col-lg-4" style="padding:5px;line-height:34px;text-align:center;">Trạng thái</div>
                <div class="col-md-8 col-xs-12 col-sm-12 col-lg-4" style="padding:5px;">
                    <select class="input_add">
                        <option selected>Tất cả</option>
                        <option>Đang sử dụng</option>
                        <option>Gần hết hạn</option>
                        <option>Đã hết hạn</option>
                    </select>
                </div>
            </div>
            <div class="col-md-3 col-xs-12 col-sm-12 col-lg-3" style="padding:0px;">
                <div class="col-md-4 col-xs-12 col-sm-12 col-lg-4" style="padding:5px;line-height:34px;text-align:center;">Dịch vụ</div>
                <div class="col-md-8 col-xs-12 col-sm-12 col-lg-8" style="padding:5px;">
                    <select class="input_add">
                        <option selected>Tất cả</option>
                        <option>Gói chuyên nghiệp</option>
                        <option>Gói khởi nghiệp</option>
                        <option>Gói dùng thử</option>
                    </select>
                </div>
            </div>
            <div class="col-md-2 col-xs-12 col-sm-12 col-lg-2" style="text-align:right;padding:5px;">
                <span class="btn btn-default" style="width:100%;border-radius:0px;background:#00d;color:#fff;font-weight:bold;">Tìm kiếm</span>
            </div>
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:0px;margin:10px 0px;height:1px;background:#ddd;"></div>
        <div id='jqxWidget' class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:10px;">
            <div id="jqxgrid"></div>
        </div>
    </div>
</asp:Content>